<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>both</title>
</head>

<body>
    <div>打开浏览器控制台查看结果</div>
    <script>
        const both =
            (f, g) =>
                (...args) =>
                    f(...args) && g(...args);
        const isEven = num => num % 2 === 0;
        const isPositive = num => num > 0;
        const isPositiveEven = both(isEven, isPositive);
        console.log(isPositiveEven(4)); // true
        console.log(isPositiveEven(-2)); // false
    </script>
</body>

</html>